<%@page import="hyl.ext.base.TokenFactory,hyl.ext.base.MyToken"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">

<meta
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
	name="viewport" />
<!-- 全局变量 函数定义区 见top.jsp -->
<%@ include file="pub/top1.jsp"%>
<!-- 实例变量 函数定义区 -->
<%
//网页title String JSPTITLE="登录" ;
%>




<meta name="description" content="">
<meta name="author" content="">

<title>注册</title>

<link type="text/css" href="<%=basePath%>cssjs/layui/css/layui.css"
	rel="stylesheet">
<script src="<%=basePath%>cssjs/layui/layui.js"></script>
<script src="<%=basePath%>cssjs/jquery/zepto.min.js"></script>
<script src="<%=basePath%>cssjs/hyl/core/safe/md5.js"></script>
<style>
body {
	background-color: #4e73df;
	height: 100vh;
	display: flex;
	/* 将div对象设置为弹性盒子 */
	justify-content: center;
	/* 将div对象内部内容水平居中 */
	align-items: center;
	/* 将div对象内部内容垂直居中 */
}

.row {
	width: 90%;
	display: flex;
	/* 将div对象设置为弹性盒子 */
	justify-content: center;
	/* 将div对象内部内容水平居中 */
	align-items: center;
	/* 将div对象内部内容垂直居中 */
	height: 85%;
	justify-content: center;
	/* 将div对象内部内容水平居中 */
	align-items: center;
}

.layui-form {
	height: 100%;
	display: flex;
	flex-direction: column;
	padding: 8px;
	align-items: center; /* 垂直等分分布 */
	justify-content: space-around;
}

.layui-input {
	height: 33px
}

.c1 {
	height: 100%;
	background-repeat: repeat; /* 平铺 */
	background-size: cover; /* 自动缩放 */
}

.c2 {
	height: 100%;
}

.btgroup {
	display: flex;
}

.btgroup button {
	flex: 1;
	width: 90px;
}
</style>
</head>

<body>



	<div class="row">
		<div class="layui-col-sm6 layui-hide-xs c1"
			style="background-image: url('<%=basePath%>cssjs/reg/img/1.jpg');"></div>
		<div class="layui-col-xs12  layui-col-sm6 c2 layui-panel">


			<div class="layui-form">

				<h1 class="h4">创建账号!</h1>

				<input type="text" class="layui-input" id="uname"
					placeholder="账号(手机号码)"> <input type="text"
					class="layui-input" id="umail" placeholder="电子邮箱:xxx@163.com">

				<button type="button" class="layui-btn  layui-btn-fluid "
					id="btnmcode">先获取验证码</button>

				<input type="text" class="layui-input" id="mcode" placeholder="验证码">


				<input type="password" class="layui-input" id="upwd"
					placeholder="密码"> <input type="password"
					class="layui-input" id="upwd_c" placeholder="重复密码"> <input
					type="text" class="layui-input" id="utjr" placeholder="推荐人">



				<div class="btgroup">
					<button type="button" id="btnreg"  class="layui-btn">提交</button>
					<button type="button" id="btnlogin" class="layui-btn ">登录</button>

				</div>




			</div>

		</div>
</body>

</html>


<script type="module">
  import "<%=basePath%>cssjs/hyl/core/fun.js";
  import "<%=basePath%>cssjs/Mm.js";

  HYL_URLS.URL_DAO_PUBLICKEY = BASEPATH.concat("l/publickey");
  HYL_URLS.URL_DAO_KEY = BASEPATH.concat("l/sm4key");
  HYL_URLS.URL_DAO_REGMCODE = BASEPATH.concat("l/reg_mcode");
  HYL_URLS.URL_DAO_REG = BASEPATH.concat("l/regMember");


  var e能否提交 = false;

  function message(e) {
    layer.msg(e, { icon: 0, anim: 5, time: 800 }, function () {
      // layer.msg('提示框关闭后的回调');
    });
  }
  $(document).ready(function () {
    Mm.f准备(HYLSessionKey,HYL_URLS, () => {
      e能否提交 = true;

    });


    $("#btnmcode").click(function () {
 	 let tel = $("#uname").val(); 
	 let umail = $("#umail").val();
		Mm.do开启倒计时按钮("btnmcode",5,()=>{});
 		Mm.f获取验证码(tel,umail,e=>{message(e)},r=>{message(r)});
	});
    $("#btnreg").click(function () {
      if (!e能否提交) return;
      if (HYL登录状态 == "1") {
        window.location = HYL_URLS.URL_LOGIN;
        return;
      }
	 let uname = $("#uname").val(); 
	 let umail = $("#umail").val();
	 let upwd = $("#upwd").val();
	 let upwd_c = $("#upwd_c").val();
	 let utjr = $("#utjr").val();
 	 let mcode = $("#mcode").val();
     let param = {mcode:mcode,uname:uname,umail:umail,upwd:upwd,upwd_c:upwd_c,utjr:utjr};
     Mm.f注册(param,e=>{},e=>{message(e);});
    });
  });



</script>